<?php

/**
 * 会员注册登录
 */
namespace User\Controller;

use Common\Controller\MemberbaseController;

class IndexController extends MemberbaseController {
    //登录
    
	function _initialize(){
		parent::_initialize();
		
	}
	
	
	public function index() {
	//	echo "会员中心";
		$this->assign ( "seo_title",  "个人中心" );


		$this->display(":index");

    }

	function  bangding(){

		if (IS_POST) {
			$code = I("post.code");
			$tel = I("post.tel");

			if (empty($code)) {
				$this->error("验证码不能为空！");
			}

			if ($code != session('code')) {
				$this->error("验证码错误");

			}
			if ($tel != session('phone')) {
				$this->error("手机号码错误");

			}
			$uid=$this->u["id"];

			D("Users")->where(array("id"=>$uid))->save(array("tel"=>$tel));

			$this->success("绑定成功",$this->jump_self);


		}else{



			$this->display(":bangding");
		}





	}

    //退出


	public function send_code(){



		$code = rand(100000,999999);
		$data["code"]=(string)$code;



		session("code",$code);


		$s=send_message($this->u["tel"],"SMS_77310004",$data);

		dump($s);






	}
	


}
?>
